<!--

生成最基本的Restful模板页面

顶部有按（门店、时间段*）查询 添加按钮

包含一个 ag-grid 列表，默认表头只有一行，每列都可查询，默认每条最后有打开、删除按钮

有新增、修改弹出层
-->

<div class="view-header">
    <!-- 查询 -->
    <div ng-show="!receipt_edit_open">
        <div class="search-shop">
            <i class="fa fa-home"></i>
            <shop-picker class="from-control"
                         shop="search_params.shop"></shop-picker>
        </div>

        <div class="search-date">
            <i class="fa fa-calendar search-date-i"></i>
            <datetimepicker class="search-date-start"
                            min-view="2"
                            end-date="search_params.date_end"
                            ng-model="search_params.date_start"></datetimepicker>

        </div>
        <div class="search-date">
            <i class="fa fa-calendar search-date-i"></i>
            <datetimepicker class="search-date-end"
                            min-view="2"
                            start-date="search_params.date_start"
                            ng-model="search_params.date_end"></datetimepicker>
        </div>
        <div class="view-header-left">
            <div class="view-header-item no-widen"
                 ng-show="!place_order_open&&!add_cover"
                 ng-click="refresh()" title="查询">
                <i class="fa fa-search"></i>
            </div>
        </div>
    </div>

    <div class="view-header-left" ng-show='receipt_edit_open'>
        <!-- <div class="view-header-item color-close above-cover"
             title="[[TITLE_HEADER_ADD_CLOSE]]" ng-click="add_open = !add_open"
             ng-show="add_open">
            <i class="fa fa-close"></i>
        </div>
        <div class="view-header-item color-check above-cover"
             title="确认添加"
             ng-click='form_add.$valid?submit_add():{};'
             title="添加提交{{form_add.$invalid?'请完成表单后再提交!':''}}"
             ng-show="add_open">
            <i class="fa fa-check" ng-show="form_add.$valid"></i>
            <i class="fa fa-ban" ng-show="form_add.$invalid"></i>
        </div> -->

        <!-- edit-->
        <!-- <div class="view-header-item color-close above-cover"
             title="[[TITLE_HEADER_EDIT_CLOSE]]"
             ng-click="edit_open = !edit_open"
             ng-show="!readonly && edit_open">
            <i class="fa fa-close"></i>
        </div>

        <div class="view-header-item color-check above-cover"
             title="确认修改"
             ng-click='form_edit.$valid?submit_edit():{};'
             title="修改提交{{form_add.$invalid?'请完成表单后再提交!':''}}"
             ng-show="!readonly && edit_open">

            <i class="fa fa-check" ng-show="form_edit.$valid"></i>
            <i class="fa fa-ban" ng-show="form_edit.$invalid"></i>
        </div> -->

        <!-- receipt -->
        <div class="view-header-item no-widen color-close above-cover"
             ng-click='receipt_edit_open = !receipt_edit_open; readonly = false;receipt_invalid = false;' title="关闭"
             ng-show='receipt_edit_open && !insurance_cover'>
            <i class="fa fa-close"></i>
        </div>
        <div class="view-header-item color-close above-cover" ng-click = 'receipt_destroy();' title="作废"
             ng-show='readonly &&receipt_edit_open &&!insurance_cover'>
            <i class="fa fa-trash-o"></i> 作废结算
        </div>
        <div class="view-header-item color-check above-cover" ng-click = 'print_receipt();' title="打印结算单"
             ng-show='(receipt.status == 8 || receipt.status == 9) &&readonly &&receipt_edit_open &&!insurance_cover'>
            <i class="fa fa-print"></i> 打印结算
        </div>


        <div class="view-header-item color-save above-cover" ng-click='form.receipt_inc_form.$valid?save_receipt():{}' title="保存结算单"
             ng-show='!readonly && receipt_edit_open && !insurance_cover'>
            <i class="fa fa-save" ng-show="form.receipt_inc_form.$valid"></i>
            <i class="fa fa-ban" ng-show="form.receipt_inc_form.$invalid"></i>
            {{form.receipt_inc_form.$invalid?'完善表单!':'保存'}}
        </div>
        <!-- <div class="view-header-item color-check above-cover" ng-click='print_receipt()' title="打印结算单"
             ng-show='!readonly && receipt_edit_open &&!insurance_cover'>
            <i class="fa fa-print"></i> 打印结算
        </div> -->
        <div class="view-header-item color-check above-cover" ng-click='submit_receipt()' title="核对结算"
             ng-show='readonly && receipt_edit_open && receipt.status !=8 && receipt.status !=9  &&!insurance_cover'>
            <i class="fa fa-check"></i> 核对确认
        </div>
        <div class="view-header-item color-check above-cover" style="z-index:2;"
             ng-click='select_insurance();insurance_cover = !insurance_cover' title="选择保险"
             ng-show='insurance_cover'>
            <i class="fa fa-check"></i> 选择保险
        </div>
    </div>
</div>
<div class="view-content ">
    <div ag-grid="grid" class="ag-material" style="height :100%"></div>
</div>

<div class="data-overlay" ng-show='receipt_edit_open'>
    <div class="overlay-container" ng-init="form = {}">
        <div class="overlay-header">费用结算单</div>
        <ng-include src="'/modules/sales/receipt/receipt.inc.html'" ></ng-include>
    </div>
</div>

<!-- 保险种类选择 -->
<!-- <div class="data-overlay invalid-container" ng-show="readonly">
    <div class="invalid-content">已作废</div>
</div> -->
<div class="data-overlay" ng-show='insurance_cover' style="z-index:1;">
    <div class="overlay-container">
        <div class="overlay-header">选择保险</div>
        <div ng-form name="form_insurance" novalidate="novalidate">
            <div class="overlay-content">
                <div class="overlay-column">
                    <div class="overlay-item" ng-repeat="item in insurance_item.data">
                        <span>{{item.type}}</span>
                        <span ng-repeat="_item in item.data">
                            <input type="radio" name="{{_item.type}}" ng-checked="_item.checked"
                                   ng-click="radio_change(_item,item.data)">
                            {{_item.name}}
                        </span>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
<div>
    <ng-include src="'/modules/sales/receipt/receipt.print.html'"></ng-include>
</div>
